package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConRaiders;
import com.htgd.gardenexpo.dao.GeConRaidersDao;
import com.htgd.gardenexpo.entity.PageQuery;
import com.htgd.gardenexpo.service.GeConRaidersService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 攻略表(GeConRaiders)表服务实现类
 *
 * @author makejava
 * @since 2021-06-11 14:09:28
 */
@Service("geConRaidersService")
public class GeConRaidersServiceImpl implements GeConRaidersService {
    @Resource
    private GeConRaidersDao geConRaidersDao;

    /**
     * 通过ID查询单条数据
     *
     * @param raidersId 主键
     * @return 实例对象
     */
    @Override
    public GeConRaiders queryById(Integer raidersId) {
        return this.geConRaidersDao.queryById(raidersId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConRaiders> queryAllByLimit(int offset, int limit) {
        return this.geConRaidersDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<GeConRaiders> getAllRaidersByValue(PageQuery pageQuery) {
        return this.geConRaidersDao.getAllRaidersByValue(pageQuery);
    }

    @Override
    public List<GeConRaiders> getAllRaidersByRmIds(String[] rmIds) {
        return this.geConRaidersDao.getAllRaidersByRmIds(rmIds);
    }
    @Override
    public List<GeConRaiders> getAllRaidersByValueNoContent(PageQuery pageQuery) {
        return this.geConRaidersDao.getAllRaidersByValueNoContent(pageQuery);
    }

    /**
     * 新增数据
     *
     * @param geConRaiders 实例对象
     * @return 实例对象
     */
    @Override
    public GeConRaiders insert(GeConRaiders geConRaiders) {
        this.geConRaidersDao.insert(geConRaiders);
        return geConRaiders;
    }

    /**
     * 修改数据
     *
     * @param geConRaiders 实例对象
     * @return 实例对象
     */
    @Override
    public GeConRaiders update(GeConRaiders geConRaiders) {
        this.geConRaidersDao.update(geConRaiders);
        return this.queryById(geConRaiders.getRaidersId());
    }

    /**
     * 通过主键删除数据
     *
     * @param raidersId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer raidersId) {
        return this.geConRaidersDao.deleteById(raidersId) > 0;
    }
}
